#pragma once
#include "const.h"
struct SectionInfo
{
	SectionInfo() {};
	~SectionInfo() { _section_data.clear(); };
	SectionInfo(const SectionInfo& src) { _section_data = src._section_data; };
	SectionInfo& operator=(const SectionInfo& src) {
		if (&src == this) {
			return *this;
		}
		_section_data = src._section_data;
		return *this;
	}
	std::map<std::string, std::string> _section_data;
	std::string operator[](const std::string& key) {
		if (_section_data.find(key) == _section_data.end()) {
			return "";
		}
		return _section_data[key];

	}
};
class configMgr
{
public:
	~configMgr() { _config_map.clear(); }
	SectionInfo operator[](const std::string& section) {
		if (_config_map.find(section) == _config_map.end()) {
			return SectionInfo();
		}
		return _config_map[section];
	}

	static configMgr& GetInst();
	
private:
	std::map<std::string, SectionInfo> _config_map;

	configMgr();
	configMgr(const configMgr& other) { _config_map = other._config_map; }
	configMgr& operator=(const configMgr& other) {
		if (&other == this) {
			return *this;
		}
		_config_map = other._config_map;
		return *this;
	}
};

